home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / ScrollingTextBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  14KB  |  384 lines

  1. package symantec.itools.multimedia;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  08/19/98    LAB    Moved to GroupAWTMultimedia folder.
  8.  
  9. /**
  10.  * BeanInfo for ScrollingText.
  11.  *
  12.  */
  13.  
  14. public class ScrollingTextBeanInfo extends SimpleBeanInfo {
  15.  
  16.     /**
  17.      * Constructs a ScrollingTextBeanInfo object.
  18.      */
  19.     public ScrollingTextBeanInfo() {
  20.     }
  21.  
  22.     /**
  23.      * Gets a BeanInfo for the superclass of this bean.
  24.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  25.      */
  26.     public BeanInfo[] getAdditionalBeanInfo() {
  27.         try {
  28.             BeanInfo[] bi = new BeanInfo[1];
  29.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  30.             return bi;
  31.         }
  32.         catch (IntrospectionException e) { throw new Error(e.toString());}
  33.     }
  34.  
  35.     /**
  36.      * Gets the SymantecBeanDescriptor for this bean.
  37.      * @return an object of type SymantecBeanDescriptor
  38.      * @see symantec.itools.beans.SymantecBeanDescriptor
  39.      */
  40.     public BeanDescriptor getBeanDescriptor() {
  41.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  42.         String s=group.getString("GroupAWTMultimedia"); 
  43.  
  44.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  45.         bd.setFolder(s);
  46.         bd.setToolbar(s);
  47.         bd.setWinHelp("0x12397");
  48.  
  49.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  50.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  51.                                                 "%name%.SCROLL_LEFT",
  52.                                                 conn.getString("SCROLL_LEFT")));
  53.  
  54.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "int", "",
  55.                                                 "%name%.SCROLL_RIGHT",
  56.                                                 conn.getString("SCROLL_RIGHT")));
  57.  
  58.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
  59.                                                 "symantec.itools.util.GeneralUtils.frameTarget_self",
  60.                                                 conn.getString("_self")));
  61.  
  62.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
  63.                                                 "symantec.itools.util.GeneralUtils.frameTarget_parent",
  64.                                                 conn.getString("_parent")));
  65.  
  66.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
  67.                                                 "symantec.itools.util.GeneralUtils.frameTarget_top",
  68.                                                 conn.getString("_top")));
  69.  
  70.         bd.addConnectionDescriptor(new ConnectionDescriptor("output", "String", "",
  71.                                                 "symantec.itools.util.GeneralUtils.frameTarget_blank",
  72.                                                 conn.getString("_blank")));
  73.  
  74.  
  75.         return (BeanDescriptor) bd;
  76.     }
  77.  
  78.     /**
  79.      * Gets an image that may be used to visually represent this bean
  80.      * (in the toolbar, on a form, etc).
  81.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  82.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  83.      * @return an image for this bean, always color even if requested monochrome
  84.      * @see BeanInfo#ICON_MONO_16x16
  85.      * @see BeanInfo#ICON_COLOR_16x16
  86.      * @see BeanInfo#ICON_MONO_32x32
  87.      * @see BeanInfo#ICON_COLOR_32x32
  88.      */
  89.     public java.awt.Image getIcon(int iconKind) {
  90.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  91.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  92.             java.awt.Image img = loadImage("ScrollingTextC16.gif");
  93.             return img;
  94.         }
  95.  
  96.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  97.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  98.             java.awt.Image img = loadImage("ScrollingTextC32.gif");
  99.             return img;
  100.         }
  101.  
  102.         return null;
  103.     }
  104.  
  105.     /**
  106.      * Gets an array of descriptions of the methods used for "connections" by
  107.      * Visual CafΘ's Interaction Wizard.
  108.      * Included in each method description is a CONNECTIONS ConnectionDescriptor.
  109.      * @return method descriptions for this bean
  110.      * @see symantec.itools.beans.ConnectionDescriptor#CONNECTIONS
  111.      */
  112.     public MethodDescriptor[] getMethodDescriptors() {
  113.         Class[] args;
  114.         ConnectionDescriptor connection;
  115.         java.util.Vector connections;
  116.         java.util.Vector md = new java.util.Vector();
  117.         ResourceBundle conn = ResourceBundle.getBundle("symantec.itools.resources.ConnBundle");
  118.  
  119.         try{
  120.             args = new Class[1];
  121.             args[0] = java.lang.Integer.TYPE ;
  122.             MethodDescriptor setScrollInterval = new MethodDescriptor(beanClass.getMethod("setScrollInterval", args));
  123.  
  124.             connections = new java.util.Vector();
  125.             connection = new ConnectionDescriptor("input", "int", "",
  126.                                     "%name%.setScrollInterval(%arg%);",
  127.                                     conn.getString("setScrollInterval"));
  128.             connections.addElement(connection);
  129.  
  130.             setScrollInterval.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  131.             md.addElement(setScrollInterval);
  132.         } catch (Exception e) { throw new Error("setScrollInterval:: " + e.toString()); }
  133.  
  134.         try{
  135.             args = null;
  136.             MethodDescriptor stopScrollingText = new MethodDescriptor(beanClass.getMethod("stopScrollingText", args));
  137.  
  138.             connections = new java.util.Vector();
  139.             connection = new ConnectionDescriptor("input", "void", "",
  140.                                     "%name%.stopScrollingText();",
  141.                                     conn.getString("stopScrollingText"));
  142.             connections.addElement(connection);
  143.  
  144.             stopScrollingText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  145.             md.addElement(stopScrollingText);
  146.         } catch (Exception e) { throw new Error("stopScrollingText:: " + e.toString()); }
  147.  
  148.         try{
  149.             args = null;
  150.             MethodDescriptor show = new MethodDescriptor(beanClass.getMethod("show", args));
  151.  
  152.             connections = new java.util.Vector();
  153.             connection = new ConnectionDescriptor("input", "void", "",
  154.                                     "%name%.show();",
  155.                                     conn.getString("show"));
  156.             connections.addElement(connection);
  157.  
  158.             show.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  159.             md.addElement(show);
  160.         } catch (Exception e) { throw new Error("show:: " + e.toString()); }
  161.  
  162.         try{
  163.             args = null;
  164.             MethodDescriptor getHiliteColor = new MethodDescriptor(beanClass.getMethod("getHiliteColor", args));
  165.  
  166.             connections = new java.util.Vector();
  167.             connection = new ConnectionDescriptor("output", "Color", "",
  168.                                     "%name%.getHiliteColor()",
  169.                                     conn.getString("getHiliteColor"));
  170.             connections.addElement(connection);
  171.  
  172.             getHiliteColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  173.             md.addElement(getHiliteColor);
  174.         } catch (Exception e) { throw new Error("getHiliteColor:: " + e.toString()); }
  175.  
  176.         try{
  177.             args = null;
  178.             MethodDescriptor getScrollInterval = new MethodDescriptor(beanClass.getMethod("getScrollInterval", args));
  179.  
  180.             connections = new java.util.Vector();
  181.             connection = new ConnectionDescriptor("output", "int", "",
  182.                                     "%name%.getScrollInterval()",
  183.                                     conn.getString("getScrollInterval"));
  184.             connections.addElement(connection);
  185.  
  186.             getScrollInterval.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  187.             md.addElement(getScrollInterval);
  188.         } catch (Exception e) { throw new Error("getScrollInterval:: " + e.toString()); }
  189.  
  190.         try{
  191.             args = new Class[1];
  192.             args[0] = java.lang.Integer.TYPE ;
  193.             MethodDescriptor setScrollDirection = new MethodDescriptor(beanClass.getMethod("setScrollDirection", args));
  194.  
  195.             connections = new java.util.Vector();
  196.             connection = new ConnectionDescriptor("input", "int", "",
  197.                                     "%name%.setScrollDirection(%arg%);",
  198.                                     conn.getString("setScrollDirection"));
  199.             connections.addElement(connection);
  200.  
  201.             setScrollDirection.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  202.             md.addElement(setScrollDirection);
  203.         } catch (Exception e) { throw new Error("setScrollDirection:: " + e.toString()); }
  204.  
  205.         try{
  206.             args = null;
  207.             MethodDescriptor hide = new MethodDescriptor(beanClass.getMethod("hide", args));
  208.  
  209.             connections = new java.util.Vector();
  210.             connection = new ConnectionDescriptor("input", "void", "",
  211.                                     "%name%.hide();",
  212.                                     conn.getString("hide"));
  213.             connections.addElement(connection);
  214.  
  215.             hide.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  216.             md.addElement(hide);
  217.         } catch (Exception e) { throw new Error("hide:: " + e.toString()); }
  218.  
  219.         try{
  220.             args = new Class[1];
  221.             args[0] = java.lang.Integer.TYPE ;
  222.             MethodDescriptor setScrollUnit = new MethodDescriptor(beanClass.getMethod("setScrollUnit", args));
  223.  
  224.             connections = new java.util.Vector();
  225.             connection = new ConnectionDescriptor("input", "int", "",
  226.                                     "%name%.setScrollUnit(%arg%);",
  227.                                     conn.getString("setScrollUnit"));
  228.             connections.addElement(connection);
  229.  
  230.             setScrollUnit.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  231.             md.addElement(setScrollUnit);
  232.         } catch (Exception e) { throw new Error("setScrollUnit:: " + e.toString()); }
  233.  
  234.         try{
  235.             args = new Class[1];
  236.             args[0] = java.awt.Color.class ;
  237.             MethodDescriptor setHiliteColor = new MethodDescriptor(beanClass.getMethod("setHiliteColor", args));
  238.  
  239.             connections = new java.util.Vector();
  240.             connection = new ConnectionDescriptor("input", "Color", "",
  241.                                     "%name%.setHiliteColor(%arg%);",
  242.                                     conn.getString("setHiliteColor"));
  243.             connections.addElement(connection);
  244.  
  245.             setHiliteColor.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  246.             md.addElement(setHiliteColor);
  247.         } catch (Exception e) { throw new Error("setHiliteColor:: " + e.toString()); }
  248.  
  249.         try{
  250.             args = null;
  251.             MethodDescriptor getScrollDirection = new MethodDescriptor(beanClass.getMethod("getScrollDirection", args));
  252.  
  253.             connections = new java.util.Vector();
  254.             connection = new ConnectionDescriptor("output", "int", "",
  255.                                     "%name%.getScrollDirection()",
  256.                                     conn.getString("getScrollDirection"));
  257.             connections.addElement(connection);
  258.  
  259.             getScrollDirection.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  260.             md.addElement(getScrollDirection);
  261.         } catch (Exception e) { throw new Error("getScrollDirection:: " + e.toString()); }
  262.  
  263.         try{
  264.             args = null;
  265.             MethodDescriptor startScrollingText = new MethodDescriptor(beanClass.getMethod("startScrollingText", args));
  266.  
  267.             connections = new java.util.Vector();
  268.             connection = new ConnectionDescriptor("input", "void", "",
  269.                                     "%name%.startScrollingText();",
  270.                                     conn.getString("startScrollingText"));
  271.             connections.addElement(connection);
  272.  
  273.             startScrollingText.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  274.             md.addElement(startScrollingText);
  275.         } catch (Exception e) { throw new Error("startScrollingText:: " + e.toString()); }
  276.  
  277.         try{
  278.             args = new Class[1];
  279.             args[0] = java.lang.String.class ;
  280.             MethodDescriptor setFrame = new MethodDescriptor(beanClass.getMethod("setFrame", args));
  281.  
  282.             connections = new java.util.Vector();
  283.             connection = new ConnectionDescriptor("input", "String", "",
  284.                                     "%name%.setFrame(%arg%);",
  285.                                     conn.getString("setFrameST"));
  286.             connections.addElement(connection);
  287.  
  288.             setFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  289.             md.addElement(setFrame);
  290.         } catch (Exception e) { throw new Error("setFrame:: " + e.toString()); }
  291.  
  292.         try{
  293.             args = null;
  294.             MethodDescriptor getFrame = new MethodDescriptor(beanClass.getMethod("getFrame", args));
  295.  
  296.             connections = new java.util.Vector();
  297.             connection = new ConnectionDescriptor("output", "String", "",
  298.                                     "%name%.getFrame()",
  299.                                     conn.getString("getFrameST"));
  300.             connections.addElement(connection);
  301.  
  302.             getFrame.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  303.             md.addElement(getFrame);
  304.         } catch (Exception e) { throw new Error("getFrame:: " + e.toString()); }
  305.  
  306.         try{
  307.             args = null;
  308.             MethodDescriptor getScrollUnit = new MethodDescriptor(beanClass.getMethod("getScrollUnit", args));
  309.  
  310.             connections = new java.util.Vector();
  311.             connection = new ConnectionDescriptor("output", "int", "",
  312.                                     "%name%.getScrollUnit()",
  313.                                     conn.getString("getScrollUnit"));
  314.             connections.addElement(connection);
  315.  
  316.             getScrollUnit.setValue(ConnectionDescriptor.CONNECTIONS, connections);
  317.             md.addElement(getScrollUnit);
  318.         } catch (Exception e) { throw new Error("getScrollUnit:: " + e.toString()); }
  319.  
  320.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  321.         md.copyInto(rv);
  322.  
  323.         return rv;
  324.     }
  325.  
  326.     /**
  327.      * Returns descriptions of this bean's properties.
  328.      */
  329.     public PropertyDescriptor[] getPropertyDescriptors() {
  330.         ResourceBundle prop = ResourceBundle.getBundle("symantec.itools.resources.PropBundle");
  331.  
  332.         try{
  333.         PropertyDescriptor scrollInterval = new PropertyDescriptor("scrollInterval", beanClass);
  334.         scrollInterval.setBound(true);
  335.         scrollInterval.setConstrained(true);
  336.         scrollInterval.setDisplayName(prop.getString("scrollInterval"));
  337.  
  338.         PropertyDescriptor scrollUnit = new PropertyDescriptor("scrollUnit", beanClass);
  339.         scrollUnit.setBound(true);
  340.         scrollUnit.setConstrained(true);
  341.         scrollUnit.setDisplayName(prop.getString("scrollUnit"));
  342.  
  343.         PropertyDescriptor scrollDirection = new PropertyDescriptor("scrollDirection", beanClass);
  344.         scrollDirection.setBound(true);
  345.         scrollDirection.setConstrained(true);
  346.         scrollDirection.setDisplayName(prop.getString("scrollDirection"));
  347.         scrollDirection.setValue("ENUMERATION", "SCROLL_LEFT=0, SCROLL_RIGHT=1");
  348.  
  349.         PropertyDescriptor hiliteColor = new PropertyDescriptor("hiliteColor", beanClass);
  350.         hiliteColor.setBound(true);
  351.         hiliteColor.setConstrained(true);
  352.         hiliteColor.setDisplayName(prop.getString("hiliteColor"));
  353.  
  354.         PropertyDescriptor messageList = new PropertyDescriptor("messageList", beanClass);
  355.         messageList.setBound(true);
  356.         messageList.setConstrained(true);
  357.         messageList.setDisplayName(prop.getString("messageList"));
  358.  
  359.         PropertyDescriptor linkToList = new PropertyDescriptor("linkToList", beanClass);
  360.         linkToList.setBound(true);
  361.         linkToList.setConstrained(true);
  362.         linkToList.setDisplayName(prop.getString("linkToList"));
  363.         linkToList.setValue("URLFILTER", prop.getString("webURLFILTER"));
  364.  
  365.         PropertyDescriptor frame = new PropertyDescriptor("frame", beanClass);
  366.         frame.setBound(true);
  367.         frame.setConstrained(true);
  368.         frame.setDisplayName(prop.getString("frame"));
  369.  
  370.         PropertyDescriptor[] rv = {
  371.             scrollInterval,
  372.             scrollUnit,
  373.             scrollDirection,
  374.             hiliteColor,
  375.             messageList,
  376.             linkToList,
  377.             frame};
  378.         return rv;
  379.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  380.     }
  381.  
  382.     private final static Class beanClass = ScrollingText.class;
  383.  
  384.     }    //  end of class ScrollingTextBeanInfo